(GtkBuilderConverter._add_action_from_menuitem): Only set stock_id
authorJohan Dahlin <johan@src.gnome.org>
Sat, 7 Jul 2007 16:18:38 +0000 (16:18 +0000)
committerJohan Dahlin <johan@src.gnome.org>
Sat, 7 Jul 2007 16:18:38 +0000 (16:18 +0000)
    on the action if the menuitem had a stock or label property set

svn path=/trunk/; revision=18395

ChangeLog
gtk/gtk-builder-convert

index 9949a697ff554d63540cfab1bc03c8f0048b1445..54f02e731a60c9a48820554ba0bf8da705712540 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,8 @@
        tags
        (GtkBuilderConverter._convert_menuitem): Add support for CheckMenuItems
        and do not set name and action on separators
+       (GtkBuilderConverter._add_action_from_menuitem): Only set stock_id
+       on the action if the menuitem had a stock or label property set
 
 2007-07-06  Richard Hult  <richard@imendio.com>
 
index d18e48638b6d9fec9f866b059c357c66354f937e..4b92157d3d39c8245dfb1658067bcb7e1c0d037c 100755 (executable)
@@ -313,7 +313,9 @@ class GtkBuilderConverter(object):
             if (children and
                 children[0].getAttribute('internal-child') == 'image'):
                 image = get_object_node(children[0])
-                properties['stock_id'] = get_property(image, 'stock')
+                stock_id = get_property(node, 'stock')
+                if stock_id is not None:
+                    properties['stock_id'] = stock_id
         elif object_class == 'GtkMenuItem':
             name = 'GtkAction'
             label = get_property(node, 'label')
@@ -333,7 +335,10 @@ class GtkBuilderConverter(object):
             raise NotImplementedError(object_class)
 
         if get_property(node, 'use_stock') == 'True':
-            properties['stock_id'] = get_property(node, 'label')
+            stock_id = get_property(node, 'label')
+            if stock_id is not None:
+                properties['stock_id'] = stock_id
+
         properties['name'] = object_id
         action = self._create_object(name,
                                      object_id,